package metaLaunch;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import update.Updater;

public class MetaLauncher {
	
	public static void main(String[] args) {
		try {
			File updater = new File(Updater.UPDATER_FILE);
			updater.delete();
			
			File updaterTemp = new File(Updater.UPDATER_TEMP_FILE);
			updaterTemp.renameTo(updater);
			
			File uTemp = new File(Updater.UPDATER_TEMP_FILE);
			uTemp.delete();
			
			String systemName = args[0];
			
			List<String> command = new ArrayList<String>();
			command.add("java");
			command.add("-jar");
			command.add("updater.jar");
			command.add("update.Updater");
			command.add(systemName);
			ProcessBuilder builder = new ProcessBuilder(command);
			builder.start();
			
			System.exit(0);
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
}